package com.poorstu.dao.impl;

import java.util.List;

import com.common.base.dao.impl.BaseDaoImpl;
import com.poorstu.dao.StudentDao;
import com.poorstu.model.AuditsMod;
import com.poorstu.model.HmenberMod;
import com.poorstu.model.HomeMod;
import com.poorstu.model.LoadMod;
import com.poorstu.model.LoginMod;
import com.poorstu.model.StudentMod;
import com.poorstu.model.UserPartTimeMod;

public class StudentDaoImpl extends BaseDaoImpl implements StudentDao{

	public void addStuApplu(UserPartTimeMod applyPartTime) {
		super.save(applyPartTime);
	}

	public List<UserPartTimeMod> selectUserPart() {
	
		return super.findAll("UserPartTimeMod");
	}

	public UserPartTimeMod selectUserPartTimeById(int userPartTimeId) {
		
		return (UserPartTimeMod)super.findByHql("from UserPartTimeMod where uspartId="+userPartTimeId).get(0);
	}

	public void partTimeApplyAudit(UserPartTimeMod userPartTime) {
			super.merge(userPartTime);
	}

	public List<UserPartTimeMod> countApplyPartTimeNumber(int partTimeId) {
		
		return super.findByHql("from  UserPartTimeMod where jobId="+partTimeId+" and "+"parStatus="+1);
	}

	public List<UserPartTimeMod> countApplyNumber(int jobId) {
	
		return super.findByHql("from UserPartTimeMod where jobId="+jobId);
	}

	public List<UserPartTimeMod> selectUserPartTimeByAllUserId(int allUserId) {
		return super.findByHql("from UserPartTimeMod where allUserId="+allUserId);
	}

	
	//查询自己的贷款申请信息
	public LoginMod selectMyLoadApply(int allUserId) {
		
		
		return (LoginMod)super.findByHql("from LoginMod where id="+allUserId).get(0);
	}

	public List<AuditsMod> selectAudit(int allUserId) {
		
		return super.findByHql("from AuditsMod where allUserId="+allUserId+"and flowId="+1);
	}

	public LoadMod selectLoad(int auditId) {
		return (LoadMod)super.findByHql("from LoadMod where auditId="+auditId).get(0);
	}

	public LoginMod selectStudent(int allUserId) {
		
		return (LoginMod)super.findByHql("from LoginMod where allUserId="+allUserId).get(0);
	}

	public LoadMod selectLoadById(int loadId) {
		
		return (LoadMod)super.findByHql("from LoadMod where loadId="+loadId).get(0);
	}

	public LoginMod selectUserByAccount(String userAccount) {
		
		return (LoginMod)super.findByHql("from LoginMod where userAccount="+userAccount);
	}

	public List<HmenberMod> getHmenber(int homeId) {
		return super.findByHql("from HmenberMod  where homeId="+homeId);
	}

	public HomeMod getHome(int homeId) {
		return (HomeMod)super.findByHql("from HomeMod where homeId="+homeId).get(0);
	}

	
	
	
	
	
	
}
